﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using AbstraX.ClientInterfaces;
using AbstraX.Contracts;
using EntityProvider.Web;
using MvvmTreeView;
using EntityProvider.Web.Entities.Client;

namespace AbstraX.ViewModels.ModelTree
{
    public static class TEMP_Method_Extensions
    {
        public static IAbstraXExtension LoadExtension(this IRoot root, IBase baseObject, ITreeNode treeNode)
        {
            if (root.ProviderType == ProviderType.EntityMap)
            {
                var extension = (IAbstraXExtension)new EntityProviderExtension();
                extension.Initialize(baseObject, treeNode);
                return extension;
            }
            else
            {
                return null;
            }
        }

        public static IAbstraXExtension LoadExtension(this IElement element, IBase baseObject, ITreeNode treeNode)
        {
            var extension = (IAbstraXExtension)new EntityProviderExtension();
            extension.Initialize(baseObject, treeNode);
            return extension;

        }

        public static IAbstraXExtension LoadExtension(this IAttribute attribute, IBase baseObject, ITreeNode treeNode)
        {
            var extension = (IAbstraXExtension)new EntityProviderExtension();
            extension.Initialize(baseObject, treeNode);
            return extension;

        }
    }
}
